
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>007数组 · 书名</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="作者">
        <meta name="identifier" content="图书编号" scheme="ISBN">
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-intopic-toc/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="008类和对象方法.html" />
    
    
    <link rel="prev" href="006循环结构.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    书名
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Books</li>
        
        
    
        <li class="chapter " data-level="2.1" >
            
                <span>
            
                    
                    Java
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="001环境变量.html">
            
                <a href="001环境变量.html">
            
                    
                    001环境变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="002Java初体验.html">
            
                <a href="002Java初体验.html">
            
                    
                    002Java初体验
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="003变量命名及数据类型.html">
            
                <a href="003变量命名及数据类型.html">
            
                    
                    003变量命名及数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="004运算符.html">
            
                <a href="004运算符.html">
            
                    
                    004运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5" data-path="005选择结构.html">
            
                <a href="005选择结构.html">
            
                    
                    005选择结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.6" data-path="006循环结构.html">
            
                <a href="006循环结构.html">
            
                    
                    006循环结构
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.1.7" data-path="007数组.html">
            
                <a href="007数组.html">
            
                    
                    007数组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.8" data-path="008类和对象方法.html">
            
                <a href="008类和对象方法.html">
            
                    
                    008类和对象方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.9" data-path="009构造方法.html">
            
                <a href="009构造方法.html">
            
                    
                    009构造方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.10" data-path="010封装与关键字static.html">
            
                <a href="010封装与关键字static.html">
            
                    
                    010封装与关键字Static
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.11" data-path="011 继承.html">
            
                <a href="011 继承.html">
            
                    
                    011 继承
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.12" data-path="012方法重写.html">
            
                <a href="012方法重写.html">
            
                    
                    012方法重写
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.13" data-path="013多态.html">
            
                <a href="013多态.html">
            
                    
                    013多态
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.14" data-path="014抽象类抽象方法.html">
            
                <a href="014抽象类抽象方法.html">
            
                    
                    014抽象类抽象方法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.15" data-path="015接口.html">
            
                <a href="015接口.html">
            
                    
                    015接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.16" data-path="016异常.html">
            
                <a href="016异常.html">
            
                    
                    016异常
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.17" data-path="017集合.html">
            
                <a href="017集合.html">
            
                    
                    017集合
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.18" data-path="017集合2.html">
            
                <a href="017集合2.html">
            
                    
                    017集合2
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.19" data-path="018泛型.html">
            
                <a href="018泛型.html">
            
                    
                    018泛型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.20" data-path="019Collections算法类.html">
            
                <a href="019Collections算法类.html">
            
                    
                    019Collections算法类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.21" data-path="020枚举.html">
            
                <a href="020枚举.html">
            
                    
                    020枚举
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.22" data-path="021包装类.html">
            
                <a href="021包装类.html">
            
                    
                    021包装类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.23" data-path="022常用类.html">
            
                <a href="022常用类.html">
            
                    
                    022常用类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.24" data-path="023File类.html">
            
                <a href="023File类.html">
            
                    
                    023File类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.25" data-path="024IO流.html">
            
                <a href="024IO流.html">
            
                    
                    024IO流
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.26" data-path="025多线程.html">
            
                <a href="025多线程.html">
            
                    
                    025多线程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.27" data-path="025多线程线程池.html">
            
                <a href="025多线程线程池.html">
            
                    
                    025多线程线程池
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.28" data-path="026网络编程Socket.html">
            
                <a href="026网络编程Socket.html">
            
                    
                    026网络编程Socket
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.29" data-path="027XML解析.html">
            
                <a href="027XML解析.html">
            
                    
                    027XML解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.30" data-path="028 注解.html">
            
                <a href="028 注解.html">
            
                    
                    028 注解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.31" data-path="029 Lambda表达式.html">
            
                <a href="029 Lambda表达式.html">
            
                    
                    029 Lambda表达式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.32" data-path="029 反射.html">
            
                <a href="029 反射.html">
            
                    
                    029 反射
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.2" >
            
                <span>
            
                    
                    Mybatis
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="../mybatis/MyBatis.html">
            
                <a href="../mybatis/MyBatis.html">
            
                    
                    MyBatis
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1.1" >
            
                <span>
            
                    
                    MyBatis
            
                </span>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" >
            
                <span>
            
                    
                    Mysql
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="../mysql/01 SQL通用语法.html">
            
                <a href="../mysql/01 SQL通用语法.html">
            
                    
                    01 SQL通用语法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.2" data-path="../mysql/02 DDL.html">
            
                <a href="../mysql/02 DDL.html">
            
                    
                    02 DDL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.3" data-path="../mysql/03 DML.html">
            
                <a href="../mysql/03 DML.html">
            
                    
                    03 DML
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.4" data-path="../mysql/04 DQL.html">
            
                <a href="../mysql/04 DQL.html">
            
                    
                    04 DQL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.5" data-path="../mysql/05 DCL.html">
            
                <a href="../mysql/05 DCL.html">
            
                    
                    05 DCL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.6" data-path="../mysql/06 函数.html">
            
                <a href="../mysql/06 函数.html">
            
                    
                    06 函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.7" data-path="../mysql/07 约束.html">
            
                <a href="../mysql/07 约束.html">
            
                    
                    07 约束
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.8" data-path="../mysql/08 多表查询.html">
            
                <a href="../mysql/08 多表查询.html">
            
                    
                    08 多表查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.9" data-path="../mysql/09 事务.html">
            
                <a href="../mysql/09 事务.html">
            
                    
                    09 事务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.10" data-path="../mysql/999zzz.html">
            
                <a href="../mysql/999zzz.html">
            
                    
                    999zzz
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.11" data-path="../mysql/MySql.html">
            
                <a href="../mysql/MySql.html">
            
                    
                    MySql
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3.12" data-path="../mysql/sql.html">
            
                <a href="../mysql/sql.html">
            
                    
                    Sql
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" >
            
                <span>
            
                    
                    Spring
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="../spring/spring.html">
            
                <a href="../spring/spring.html">
            
                    
                    Spring
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" >
            
                <span>
            
                    
                    SpringMVC
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="../springMVC/springMVC.html">
            
                <a href="../springMVC/springMVC.html">
            
                    
                    SpringMVC
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.6" >
            
                <span>
            
                    
                    整合
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.6.1" data-path="../整合/Mybatis框架.html">
            
                <a href="../整合/Mybatis框架.html">
            
                    
                    Mybatis框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.2" data-path="../整合/SpringBoot.html">
            
                <a href="../整合/SpringBoot.html">
            
                    
                    SpringBoot
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.3" data-path="../整合/springmvc框架.html">
            
                <a href="../整合/springmvc框架.html">
            
                    
                    Springmvc框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.4" data-path="../整合/spring框架.html">
            
                <a href="../整合/spring框架.html">
            
                    
                    Spring框架
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >007数组</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x6570;&#x7EC4;&#x662F;&#x4EC0;&#x4E48;">&#x6570;&#x7EC4;&#x662F;&#x4EC0;&#x4E48;</h1>
<p>&#x7B80;&#x5355;&#x6765;&#x8BF4;&#xFF0C;&#x6570;&#x7EC4;&#x662F;&#x5B58;&#x50A8;&#x76F8;&#x540C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x6570;&#x636E;&#x7684;&#x5BB9;&#x5668;&#x3002;
&#x5728;&#x4E4B;&#x524D;&#xFF0C;&#x6211;&#x4EEC;&#x90FD;&#x662F;&#x4F7F;&#x7528;&#x53D8;&#x91CF;&#x5F53;&#x4F5C;&#x5B58;&#x50A8;&#x6570;&#x636E;&#x7684;&#x5BB9;&#x5668;&#xFF0C;&#x4F46;&#x662F;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x53EA;&#x80FD;&#x5B58;&#x50A8;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#xFF0C;&#x5C40;&#x9650;&#x6027;&#x5F88;&#x5927;&#x3002;&#x800C;&#x6570;&#x636E;&#x6B63;&#x597D;&#x80FD;&#x89E3;&#x51B3;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#xFF0C;&#x7528;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x5B58;&#x50A8;&#x591A;&#x4E2A;&#x6570;&#x636E;&#x3002;</p>
<h1 id="&#x6570;&#x7EC4;&#x7684;&#x57FA;&#x672C;&#x8981;&#x7D20;">&#x6570;&#x7EC4;&#x7684;&#x57FA;&#x672C;&#x8981;&#x7D20;</h1>
<ul>
<li>&#x6807;&#x8BC6;&#x7B26;</li>
<li>&#x6570;&#x7EC4;&#x5143;&#x7D20;</li>
<li>&#x5143;&#x7D20;&#x4E0B;&#x6807;&#xFF1A;&#x4ECE;<code>0</code>&#x5F00;&#x59CB;</li>
<li>&#x5143;&#x7D20;&#x7C7B;&#x578B;
<img src="https://img-blog.csdnimg.cn/89f73417e4ab485b9892d2ee894f572f.png" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;"><h1 id="&#x4F7F;&#x7528;&#x6570;&#x7EC4;">&#x4F7F;&#x7528;&#x6570;&#x7EC4;</h1>
</li>
<li>&#x58F0;&#x660E;&#x6570;&#x7EC4;<pre><code class="lang-java">&#x6570;&#x636E;&#x7C7B;&#x578B; &#x6570;&#x7EC4;&#x540D;[];  <span class="hljs-keyword">int</span> arr[];
&#x6570;&#x636E;&#x7C7B;&#x578B;[] &#x6570;&#x7EC4;&#x540D;;  <span class="hljs-keyword">int</span>[] arr;
</code></pre>
</li>
<li>&#x5206;&#x914D;&#x7A7A;&#x95F4;<pre><code class="lang-java">&#x6570;&#x636E;&#x7C7B;&#x578B; &#x6570;&#x7EC4;&#x540D; = <span class="hljs-keyword">new</span> &#x6570;&#x636E;&#x7C7B;&#x578B;[&#x6570;&#x7EC4;&#x957F;&#x5EA6;];
<span class="hljs-keyword">int</span> arr = <span class="hljs-keyword">new</span> <span class="hljs-keyword">int</span>[<span class="hljs-number">5</span>];
</code></pre>
</li>
<li>&#x8D4B;&#x503C;
```java
&#x6570;&#x7EC4;&#x540D;[&#x4E0B;&#x6807;] = &#x6570;&#x636E;; &#x6CE8;&#x610F;:(&#x4E0B;&#x6807;&#x4ECE;0&#x5F00;&#x59CB;)
  arr[0] = 10;
  arr[1] = 20;
  arr[2] = 45;
  arr[3] = 55;</li>
</ul>
<pre><code>4. &#x5904;&#x7406;&#x6570;&#x636E;
```java
  byte/short/int/long&#x7C7B;&#x578B;&#x6570;&#x7EC4;&#x5143;&#x7D20;&#x9ED8;&#x8BA4;&#x503C;&#xFF1A;0
  float/double&#x7C7B;&#x578B;&#x6570;&#x7EC4;&#x5143;&#x7D20;&#x9ED8;&#x8BA4;&#x503C;&#xFF1A;0.0
  char&#x7C7B;&#x578B;&#x6570;&#x7EC4;&#x5143;&#x7D20;&#x9ED8;&#x8BA4;&#x503C;&#xFF1A;&quot; &quot;
  boolean&#x7C7B;&#x578B;&#x6570;&#x7EC4;&#x5143;&#x7D20;&#x9ED8;&#x8BA4;&#x503C;&#xFF1A;false
  String&#x7C7B;&#x578B;&#x6570;&#x7EC4;&#x5143;&#x7D20;&#x9ED8;&#x8BA4;&#x503C;&#xFF1A;null
</code></pre><h1 id="&#x6570;&#x7EC4;&#x521D;&#x59CB;&#x5316;">&#x6570;&#x7EC4;&#x521D;&#x59CB;&#x5316;</h1>
<blockquote>
<p>&#x5728;<strong>&#x521B;&#x5EFA;</strong>&#x6570;&#x7EC4;&#x65F6;
&#x5982;&#x679C;&#x5728;&#x521B;&#x5EFA;&#x7684;&#x540C;&#x65F6;&#x4E0D;<strong>&#x521D;&#x59CB;&#x5316;&#x6570;&#x7EC4;</strong>&#xFF0C;&#x5219;&#x5FC5;&#x987B;&#x6307;&#x5B9A;&#x5176;<strong>&#x5927;&#x5C0F;</strong>
&#x4E0D;&#x6307;&#x5B9A;&#x6570;&#x7EC4;<strong>&#x5927;&#x5C0F;</strong>&#x5219;&#x5FC5;&#x987B;&#x5728;&#x521B;&#x5EFA;&#x7684;&#x540C;&#x65F6;<strong>&#x521D;&#x59CB;&#x5316;&#x6570;&#x7EC4;</strong>&#x3002;</p>
</blockquote>
<ol>
<li>&#x9759;&#x6001;&#x521D;&#x59CB;&#x5316;</li>
</ol>
<pre><code class="lang-java"> <span class="hljs-keyword">int</span>[ ]  intArray;
 intArray = <span class="hljs-keyword">new</span> <span class="hljs-keyword">int</span>[ ] {<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-number">3</span>,<span class="hljs-number">4</span>,<span class="hljs-number">5</span>};
</code></pre>
<ol>
<li>&#x7B80;&#x6613;&#x9759;&#x6001;&#x521D;&#x59CB;&#x5316;</li>
</ol>
<pre><code class="lang-java"> String[] strArray = {<span class="hljs-string">&quot;&#x5F20;&#x4E09;&quot;</span>, <span class="hljs-string">&quot;&#x674E;&#x56DB;&quot;</span>, <span class="hljs-string">&quot;&#x738B;&#x4E94;&quot;</span> };
</code></pre>
<ol>
<li>&#x52A8;&#x6001;&#x521D;&#x59CB;&#x5316;
 &#x521D;&#x59CB;&#x5316;&#x65F6;&#x6307;&#x5B9A;&#x6570;&#x7EC4;&#x7684;&#x957F;&#x5EA6;&#xFF0C;&#x7531;&#x7CFB;&#x7EDF;&#x521D;&#x59CB;&#x5316;&#x6BCF;&#x4E2A;&#x6570;&#x7EC4;&#x5143;&#x7D20;&#x7684;&#x9ED8;&#x8BA4;&#x503C;<pre><code class="lang-java"><span class="hljs-keyword">int</span>[] price = <span class="hljs-keyword">new</span> <span class="hljs-keyword">int</span>[<span class="hljs-number">4</span>];
</code></pre>
</li>
</ol>
<p><strong>&#x6CE8;&#x610F;</strong></p>
<ul>
<li>&#x6570;&#x7EC4;&#x957F;&#x5EA6;&#x56FA;&#x5B9A;&#x4E0D;&#x53D8;&#xFF0C;&#x907F;&#x514D;&#x6570;&#x7EC4;&#x8D8A;&#x754C;</li>
<li>&#x6570;&#x7EC4;&#x4E2D;&#x7684;&#x6240;&#x6709;&#x5143;&#x7D20;&#x5FC5;&#x987B;&#x5C5E;&#x4E8E;&#x76F8;&#x540C;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;</li>
<li>&#x58F0;&#x660E;&#x6570;&#x7EC4;&#x65F6;&#x89C4;&#x5B9A;&#x6570;&#x7EC4;&#x957F;&#x5EA6;</li>
<li>&#x6570;&#x7EC4;&#x5143;&#x7D20;&#x6839;&#x636E;&#x7C7B;&#x578B;&#x4E0D;&#x540C;&#xFF0C;&#x6709;&#x4E0D;&#x540C;&#x7684;&#x521D;&#x59CB;&#x503C;</li>
</ul>
<blockquote>
<p>&#x5728;&#x5B66;&#x4E60;&#x5B8C;&#x5982;&#x4F55;&#x521B;&#x5EFA;&#x548C;&#x4F7F;&#x7528;&#x6570;&#x7EC4;&#x4E4B;&#x540E;&#xFF0C;&#x63A5;&#x4E0B;&#x6765;&#x5C31;&#x662F;&#x6570;&#x7EC4;&#x8FDB;&#x9636;&#x7BC7;
&#x5B9E;&#x73B0;&#x6570;&#x7EC4;&#x7684;&#x5143;&#x7D20;&#x7684;&#x589E;&#x5220;&#x6539;&#xFF0C;&#x53CA;Arrays&#x7C7B;&#x4E2D;&#x7684;&#x5E38;&#x7528;&#x7684;&#x65B9;&#x6CD5;</p>
</blockquote>
<p>&#x63A5;&#x4E0B;&#x6765;&#x7684;&#x6587;&#x7AE0;&#x6211;&#x4F1A;&#x4EE5;&#x9898;&#x76EE;&#x7684;&#x5F62;&#x5F0F;&#x4E00;&#x6B65;&#x4E00;&#x6B65;&#x8BB2;&#x89E3;</p>
<p><strong>&#x9898;&#x76EE;&#x4E00;</strong>
&#x4ECE;&#x952E;&#x76D8;&#x8F93;&#x5165;&#x672C;&#x6B21;Java&#x8003;&#x8BD5;&#x4E94;&#x4F4D;&#x5B66;&#x751F;&#x7684;&#x6210;&#x7EE9;&#xFF0C;&#x6C42;&#x8003;&#x8BD5;&#x6210;&#x7EE9;&#x6700;&#x9AD8;&#x5206;</p>
<pre><code class="lang-java"><span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>{
        <span class="hljs-comment">// &#x4ECE;&#x952E;&#x76D8;&#x8F93;&#x5165;&#x672C;&#x6B21;Java&#x8003;&#x8BD5;&#x4E94;&#x4F4D;&#x5B66;&#x751F;&#x7684;&#x6210;&#x7EE9;&#xFF0C;&#x6C42;&#x8003;&#x8BD5;&#x6210;&#x7EE9;&#x6700;&#x9AD8;&#x5206;</span>
        Scanner scanner = <span class="hljs-keyword">new</span> Scanner(System.in);
        <span class="hljs-comment">// &#x521B;&#x5EFA;&#x957F;&#x5EA6;&#x4E3A;5&#x7684;&#x6570;&#x7EC4;</span>
        <span class="hljs-keyword">int</span>[] arr = <span class="hljs-keyword">new</span> <span class="hljs-keyword">int</span>[<span class="hljs-number">5</span>];
        System.out.println(<span class="hljs-string">&quot;&#x8F93;&#x5165;5&#x4E2A;&#x6574;&#x6570;&quot;</span>);
        <span class="hljs-comment">// &#x6570;&#x7EC4;&#x4E2D;&#x8D4B;&#x503C;</span>
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>; i &lt; arr.length; i++) {
            arr[i] = scanner.nextInt();
        }
        <span class="hljs-comment">// &#x6570;&#x7EC4;&#x904D;&#x5386;</span>
        <span class="hljs-keyword">int</span> flag = <span class="hljs-number">0</span>;
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>; i &lt; arr.length; i++) {
            <span class="hljs-keyword">if</span> (arr[i] &gt; flag) {
                flag = arr[i];
            }
        }
        System.out.println(<span class="hljs-string">&quot;&#x5176;&#x4E2D;&#x6700;&#x5927;&#x7684;&#x662F;&quot;</span> + flag);
        System.out.println(<span class="hljs-string">&quot;over&quot;</span>);
    }
</code></pre>
<p><strong>&#x9898;&#x76EE;&#x4E8C;</strong></p>
<p>&#x6709;&#x4E00;&#x7EC4;&#x5B66;&#x5458;&#x7684;&#x6210;&#x7EE9;{99&#xFF0C;85&#xFF0C;82&#xFF0C;63&#xFF0C; 60}&#xFF0C;&#x5C06;&#x5B83;&#x4EEC;&#x6309;&#x964D;&#x5E8F;&#x6392;&#x5217;&#x3002; &#x8981;&#x589E;&#x52A0;&#x4E00;&#x4E2A;&#x5B66;&#x5458;&#x7684;&#x6210;&#x7EE9;&#xFF0C;&#x5C06;&#x5B83;&#x63D2;&#x5165;&#x6210;&#x7EE9;&#x5E8F;&#x5217;&#xFF0C;&#x5E76;&#x4FDD;&#x6301;&#x964D;&#x5E8F;</p>
<pre><code class="lang-java">        <span class="hljs-keyword">int</span>[] scores = { <span class="hljs-number">99</span>, <span class="hljs-number">85</span>, <span class="hljs-number">82</span>, <span class="hljs-number">63</span>, <span class="hljs-number">60</span> };

        <span class="hljs-comment">// 1&#xFF09;&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;&#x6BD4;&#x539F;&#x6765;&#x6570;&#x7EC4;&#x957F;&#x5EA6;&#x5927;1&#x7684;&#x6570;&#x7EC4;</span>
        <span class="hljs-keyword">int</span>[] newScores = <span class="hljs-keyword">new</span> <span class="hljs-keyword">int</span>[scores.length + <span class="hljs-number">1</span>];

        <span class="hljs-comment">// 2&#xFF09;&#x5C06;&#x539F;&#x6765;&#x6570;&#x7EC4;&#x91CC;&#x7684;&#x5143;&#x7D20;&#x6309;&#x7167;&#x987A;&#x5E8F;&#x5B58;&#x50A8;&#x5230;&#x65B0;&#x7684;&#x6570;&#x7EC4;&#x4E2D;</span>
        <span class="hljs-keyword">for</span>(<span class="hljs-keyword">int</span> i =<span class="hljs-number">0</span>;i&lt;scores.length;i++){
            newScores[i]=scores[i];
        }

        <span class="hljs-comment">//3&#xFF09;&#x4F7F;&#x7528;Scanner&#x83B7;&#x53D6;&#x4F60;&#x8981;&#x589E;&#x52A0;&#x7684;&#x5B66;&#x5458;&#x6210;&#x7EE9;</span>
        Scanner sc = <span class="hljs-keyword">new</span> Scanner(System.in);
        System.out.println(<span class="hljs-string">&quot;&#x8BF7;&#x8F93;&#x5165;&#x4F60;&#x8981;&#x589E;&#x52A0;&#x7684;&#x5B66;&#x5458;&#x6210;&#x7EE9;&#xFF1A;&quot;</span>);
        <span class="hljs-keyword">int</span> insert = sc.nextInt();

        <span class="hljs-comment">//4&#xFF09;&#x901A;&#x8FC7;&#x5FAA;&#x73AF;&#x6BD4;&#x8F83;&#xFF0C;&#x83B7;&#x53D6;&#x63D2;&#x5165;&#x5143;&#x7D20;&#x8981;&#x63D2;&#x5165;&#x7684;&#x4F4D;&#x7F6E;&#xFF08;&#x4E0B;&#x6807;&#xFF09;</span>
        <span class="hljs-keyword">int</span> index = newScores.length-<span class="hljs-number">1</span>;
        <span class="hljs-keyword">for</span>(<span class="hljs-keyword">int</span> i =<span class="hljs-number">0</span>;i&lt;newScores.length;i++){
            <span class="hljs-keyword">if</span>(insert&gt;newScores[i]){
                index = i;
                <span class="hljs-comment">//&#x4E00;&#x65E6;&#x83B7;&#x53D6;&#x63D2;&#x5165;&#x5143;&#x7D20;&#x6BD4;&#x67D0;&#x4E00;&#x4E2A;&#x5143;&#x7D20;&#x5927;&#xFF0C;&#x5C31;&#x4E0D;&#x518D;&#x5F80;&#x540E;&#x8FDB;&#x884C;&#x6BD4;&#x8F83;&#x4E86;&#xFF0C;&#x7ED3;&#x675F;&#x6574;&#x4E2A;&#x6BD4;&#x8F83;&#x8FC7;&#x7A0B;</span>
                <span class="hljs-keyword">break</span>;
            }
        }

        <span class="hljs-comment">//5&#xFF09;&#x4ECE;&#x63D2;&#x5165;&#x4F4D;&#x7F6E;&#x5F00;&#x59CB;&#x53CA;&#x4E4B;&#x540E;&#x7684;&#x5143;&#x7D20;&#x4F9D;&#x6B21;&#x5F80;&#x540E;&#x79FB;&#x52A8;&#x4E00;&#x4F4D;&#xFF08;&#x6CE8;&#x610F;&#xFF1A;&#x79FB;&#x52A8;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4ECE;&#x540E;&#x5411;&#x524D;&#x79FB;&#x52A8;&#xFF09;</span>
        <span class="hljs-keyword">for</span>(<span class="hljs-keyword">int</span> i =newScores.length-<span class="hljs-number">1</span>;i&gt;index;i--){
            newScores[i]=newScores[i-<span class="hljs-number">1</span>];
        }

        <span class="hljs-comment">//6&#xFF09;&#x79FB;&#x52A8;&#x5143;&#x7D20;&#x4E4B;&#x540E;&#xFF0C;&#x63D2;&#x5165;&#x4F4D;&#x7F6E;&#x5C31;&#x7A7A;&#x51FA;&#x6765;&#x4E86;&#xFF0C;&#x5C06;&#x63D2;&#x5165;&#x5143;&#x7D20;&#x5B58;&#x50A8;&#x5230;&#x63D2;&#x5165;&#x4F4D;&#x7F6E;</span>
        newScores[index]=insert;

        <span class="hljs-comment">//&#x63D2;&#x5165;&#x5143;&#x7D20;&#x4E4B;&#x540E;&#xFF0C;&#x904D;&#x5386;&#x6570;&#x7EC4;</span>
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>; i &lt; newScores.length; i++) {
            System.out.print(newScores[i]+<span class="hljs-string">&quot; &quot;</span>);
        }
</code></pre>
<p><strong>&#x9898;&#x76EE;&#x4E09;</strong>
&#x6C42;&#x51FA;4&#x5BB6;&#x5E97;&#x7684;&#x6700;&#x4F4E;&#x624B;&#x673A;&#x4EF7;&#x683C;</p>
<pre><code class="lang-java">    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>{
        <span class="hljs-comment">// &#x6C42;&#x51FA;4&#x5BB6;&#x5E97;&#x7684;&#x6700;&#x4F4E;&#x624B;&#x673A;&#x4EF7;&#x683C;</span>

        <span class="hljs-comment">// &#x58F0;&#x660E;&#x957F;&#x5EA6;&#x4E3A;4&#x7684;&#x6570;&#x7EC4;</span>
        <span class="hljs-keyword">int</span> [] arr =  <span class="hljs-keyword">new</span> <span class="hljs-keyword">int</span>[<span class="hljs-number">4</span>];

        <span class="hljs-comment">//&#x952E;&#x76D8;&#x5F55;&#x5165;4&#x4E2A;&#x624B;&#x673A;&#x4EF7;&#x683C; &#x5E76;&#x5B58;&#x50A8;&#x5230;&#x6570;&#x7EC4;&#x4E2D;</span>
        Scanner sc  = <span class="hljs-keyword">new</span> Scanner(System.in);
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>; i &lt; arr.length; i++) {
            arr[i] = sc.nextInt(); 
        }

        <span class="hljs-comment">// &#x83B7;&#x53D6;&#x6700;&#x4F4E;&#x4EF7;&#x683C;</span>
        <span class="hljs-keyword">int</span> min = arr[<span class="hljs-number">0</span>];
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>; i &lt; arr.length; i++) {
            <span class="hljs-keyword">if</span> (arr[i] &lt; min) {
                min = arr[i];
            }
        }
        System.out.println(<span class="hljs-string">&quot;&#x624B;&#x673A;&#x6700;&#x4F4E;&#x4EF7;&#x683C;&#x662F;&quot;</span>+min);

    }
</code></pre>
<p><strong>&#x9898;&#x76EE;&#x56DB;</strong>
&#x6570;&#x7EC4;&#x5B58;&#x50A8;5&#x7B14;&#x8D2D;&#x7269;&#x91D1;&#x989D;&#xFF0C;&#x5728;&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x51FA;&#x5E76;&#x8BA1;&#x7B97;&#x603B;&#x91D1;&#x989D;</p>
<pre><code class="lang-java">    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>{
        <span class="hljs-comment">// &#x6570;&#x7EC4;&#x5B58;&#x50A8;5&#x7B14;&#x8D2D;&#x7269;&#x91D1;&#x989D;&#xFF0C;&#x5728;&#x63A7;&#x5236;&#x53F0;&#x8F93;&#x51FA;&#x5E76;&#x8BA1;&#x7B97;&#x603B;&#x91D1;&#x989D;</span>

        <span class="hljs-comment">// &#x58F0;&#x660E;&#x957F;&#x5EA6;&#x4E3A;5&#x7684;&#x6570;&#x7EC4;</span>
        <span class="hljs-keyword">int</span> [] doller = <span class="hljs-keyword">new</span> <span class="hljs-keyword">int</span> [<span class="hljs-number">5</span>];
        Scanner scanner = <span class="hljs-keyword">new</span> Scanner(System.in);
        <span class="hljs-keyword">int</span> sum = <span class="hljs-number">0</span>;
        <span class="hljs-comment">// &#x952E;&#x76D8;&#x5F55;&#x5165;&#xFF0C;&#x5E76;&#x50A8;&#x5B58;&#x5728;&#x6570;&#x7EC4;&#x4E2D;</span>
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>; i &lt; doller.length; i++) {
            System.out.print(<span class="hljs-string">&quot;&#x8BF7;&#x8F93;&#x5165;&#x7B2C;&quot;</span>+(i+<span class="hljs-number">1</span>)+<span class="hljs-string">&quot;&#x7B14;&#x91D1;&#x989D;&#xFF1A;&quot;</span>);
            doller[i] = scanner.nextInt();
        }
        <span class="hljs-comment">// &#x7D2F;&#x52A0;</span>
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>; i &lt; doller.length; i++) {
            sum += doller[i];
        }

        <span class="hljs-comment">// &#x6570;&#x7EC4;&#x904D;&#x5386;</span>
        System.out.println(<span class="hljs-string">&quot;&#x5E8F;&#x53F7;\t\t&#x91D1;&#x989D;&#xFF08;&#x5143;&#xFF09;&quot;</span>);
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>; i &lt; doller.length; i++) {
            System.out.println((i+<span class="hljs-number">1</span>)+<span class="hljs-string">&quot;\t\t&quot;</span>+doller[i]);
        }
        System.out.println(<span class="hljs-string">&quot;&#x603B;&#x91D1;&#x989D;\t\t&quot;</span>+sum);
    }
</code></pre>
<p><strong>&#x9898;&#x76EE;&#x516D;</strong>
&#x5220;&#x9664;&#x6307;&#x5B9A;&#x4E0B;&#x8868;&#x4E2D;&#x7684;&#x6570;&#x7EC4;&#x5143;&#x7D20;</p>
<pre><code class="lang-java"><span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>{
        <span class="hljs-comment">// &#x5220;&#x9664;&#x6307;&#x5B9A;&#x4E0B;&#x8868;&#x4E2D;&#x7684;&#x6570;&#x7EC4;&#x5143;&#x7D20;</span>
        <span class="hljs-keyword">int</span>[] num = { <span class="hljs-number">21</span>, <span class="hljs-number">44</span>, <span class="hljs-number">15</span>, <span class="hljs-number">34</span>, <span class="hljs-number">87</span>, <span class="hljs-number">44</span>, <span class="hljs-number">13</span>, <span class="hljs-number">64</span>, <span class="hljs-number">51</span>, <span class="hljs-number">89</span> };
        System.out.println(Arrays.toString(num));
        Scanner sc = <span class="hljs-keyword">new</span> Scanner(System.in);
        System.out.println(<span class="hljs-string">&quot;&#x8BF7;&#x8F93;&#x5165;&#x4F60;&#x8981;&#x5220;&#x9664;&#x7684;&#x5143;&#x7D20;&#x4E0B;&#x6807;0-&quot;</span> + (num.length - <span class="hljs-number">1</span>));
        <span class="hljs-keyword">int</span> index = sc.nextInt();
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i = index; i &lt; num.length - <span class="hljs-number">1</span>; i++) {
            num[i] = num[i + <span class="hljs-number">1</span>];
        }
        <span class="hljs-keyword">int</span>[] numc = <span class="hljs-keyword">new</span> <span class="hljs-keyword">int</span>[num.length - <span class="hljs-number">1</span>];
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>; i &lt; numc.length; i++) {
            numc[i] = num[i];
        }
        System.out.println(Arrays.toString(num));
        System.out.println(Arrays.toString(numc));
        num = numc;
        System.out.println(Arrays.toString(num));
        System.out.println(num.length);
    }
</code></pre>
<p><strong>&#x5192;&#x6CE1;&#x6392;&#x5E8F;</strong>
<img src="https://img-blog.csdnimg.cn/5130411e7ea24a57ad841829c245ba73.gif" alt="&#x8BF7;&#x6DFB;&#x52A0;&#x56FE;&#x7247;&#x63CF;&#x8FF0;"></p>
<pre><code class="lang-java">    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">(String[] args)</span> </span>{
        <span class="hljs-comment">// &#x5192;&#x6CE1;&#x6392;&#x5E8F;</span>
        <span class="hljs-keyword">int</span>[] num = { <span class="hljs-number">21</span>, <span class="hljs-number">44</span>, <span class="hljs-number">15</span>, <span class="hljs-number">34</span>, <span class="hljs-number">87</span>, <span class="hljs-number">44</span>, <span class="hljs-number">13</span>, <span class="hljs-number">64</span>, <span class="hljs-number">51</span>, <span class="hljs-number">89</span> };

        <span class="hljs-comment">// &#x6392;&#x5E8F;&#x524D;</span>
        System.out.println(Arrays.toString(num));
        <span class="hljs-comment">// &#x6392;&#x5E8F;</span>
        <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> i = <span class="hljs-number">0</span>; i &lt; num.length - <span class="hljs-number">1</span>; i++) {
            <span class="hljs-keyword">for</span> (<span class="hljs-keyword">int</span> j = <span class="hljs-number">0</span>; j &lt; num.length - <span class="hljs-number">1</span> - i; j++) {
                <span class="hljs-keyword">if</span> (num[j] &gt; num[j + <span class="hljs-number">1</span>]) {
                    <span class="hljs-keyword">int</span> temp = num[j];
                    num[j] = num[j + <span class="hljs-number">1</span>];
                    num[j + <span class="hljs-number">1</span>] = temp;
                }
            }
        }
        <span class="hljs-comment">// &#x6392;&#x5E8F;&#x540E;</span>
        System.out.println(Arrays.toString(num));
    }
</code></pre>
<p><strong>Arrays&#x5E38;&#x7528;&#x65B9;&#x6CD5;</strong></p>
<table>
<thead>
<tr>
<th style="text-align:left"><code>&#x65B9;&#x6CD5;&#x540D;</code></th>
<th style="text-align:left"><code>&#x8BF4;&#x660E;</code></th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left"><code>Arrays.equals(array1,array2);</code></td>
<td style="text-align:left">&#x6BD4;&#x8F83;array1&#x548C;array2&#x4E24;&#x4E2A;&#x6570;&#x7EC4;&#x662F;&#x5426;&#x76F8;&#x7B49;</td>
</tr>
<tr>
<td style="text-align:left"><code>Arrays.sort(array)</code></td>
<td style="text-align:left">&#x5BF9;&#x6570;&#x7EC4;array&#x7684;&#x5143;&#x7D20;&#x8FDB;&#x884C;&#x5347;&#x5E8F;&#x6392;&#x5217;</td>
</tr>
<tr>
<td style="text-align:left"><code>Arrays.toString(array)</code></td>
<td style="text-align:left">&#x5C06;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;array&#x8F6C;&#x6362;&#x6210;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;&#x4E32;</td>
</tr>
<tr>
<td style="text-align:left"><code>Arrays.fill(array,val)</code></td>
<td style="text-align:left">&#x628A;&#x6570;&#x7EC4;array&#x6240;&#x6709;&#x5143;&#x7D20;&#x90FD;&#x8D4B;&#x503C;&#x4E3A;val</td>
</tr>
<tr>
<td style="text-align:left"><code>Arrays.copyOf(array,length)</code></td>
<td style="text-align:left">&#x628A;&#x6570;&#x7EC4;array&#x590D;&#x5236;&#x6210;&#x4E00;&#x4E2A;&#x957F;&#x5EA6;&#x4E3A;length&#x7684;&#x65B0;&#x6570;&#x7EC4;&#xFF0C;&#x8FD4;&#x56DE;&#x7C7B;&#x578B;&#x4E0E;&#x590D;&#x5236;&#x7684;&#x6570;&#x7EC4;&#x4E00;&#x81F4;</td>
</tr>
<tr>
<td style="text-align:left"><code>Arrays.binarySearch(array, val)</code></td>
<td style="text-align:left">&#x67E5;&#x8BE2;&#x5143;&#x7D20;&#x503C;val&#x5728;&#x6570;&#x7EC4;array&#x4E2D;&#x7684;&#x4E0B;&#x6807;&#xFF08;&#x8981;&#x6C42;&#x6570;&#x7EC4;&#x4E2D;&#x5143;&#x7D20;&#x5DF2;&#x7ECF;&#x6309;&#x5347;&#x5E8F;&#x6392;&#x5217;&#xFF09;</td>
</tr>
</tbody>
</table>
<hr>
<p>&#x5728;&#x4E4B;&#x524D;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x8BB2;&#x89E3;&#x4E86;&#x4EC0;&#x4E48;&#x662F;&#x6570;&#x7EC4;&#xFF0C;&#x6570;&#x7EC4;&#x5C31;&#x662F;&#x5B58;&#x50A8;&#x76F8;&#x540C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x6570;&#x636E;&#x7684;&#x5BB9;&#x5668;&#x3002;
&#x4E5F;&#x5C31;&#x662F;&#x8BF4;&#x76F8;&#x540C;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x7684;&#x6570;&#x636E;&#x90FD;&#x7ED9;&#x53EF;&#x4EE5;&#x50A8;&#x5B58;&#x5728;&#x6570;&#x7EC4;&#x4E2D;&#xFF0C;&#x90A3;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x9050;&#x60F3;&#x4E00;&#x4E0B;&#xFF0C;&#x5982;&#x679C;&#x6570;&#x7EC4;&#x4E2D;&#x5B58;&#x50A8;&#x7684;&#x6570;&#x636E;&#x662F;&#x6570;&#x7EC4;&#xFF0C;&#x8FD9;&#x53C8;&#x4F1A;&#x662F;&#x4EC0;&#x4E48;&#x6837;&#x7684;&#x5462;&#x3002;</p>
<p><strong>&#x4EC0;&#x4E48;&#x662F;&#x4E8C;&#x7EF4;&#x6570;&#x7EC4;</strong>
&#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x5C31;&#x662F;&#xFF0C;&#x4E00;&#x4E2A;&#x666E;&#x901A;&#x6570;&#x7EC4;&#x91CC;&#x9762;&#x50A8;&#x5B58;&#x7684;&#x6570;&#x636E;&#x4E5F;&#x662F;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;</p>
<p><strong>&#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x7684;&#x58F0;&#x660E;</strong>
&#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x7684;&#x58F0;&#x660E;&#x548C;&#x8D4B;&#x503C;&#x65B9;&#x5F0F;&#x548C;&#x4E00;&#x7EF4;&#x6570;&#x7EC4;&#x7C7B;&#x4F3C;&#xFF0C;&#x53EA;&#x9700;&#x8981;&#x5728;&#x591A;&#x52A0;&#x4E00;&#x5BF9; [ ] &#x8868;&#x793A;</p>
<pre><code class="lang-java">&#x6570;&#x636E;&#x7C7B;&#x578B;[][] &#x6570;&#x7EC4;&#x540D;; &#x6216;&#x8005; &#x6570;&#x636E;&#x7C7B;&#x578B;&#x6570;&#x7EC4;&#x540D; [][];
<span class="hljs-keyword">int</span>[][] nums;
String[][] strings;
</code></pre>
<p><strong>&#x5206;&#x914D;&#x7A7A;&#x95F4;</strong>
<code>nums = new int[5][2];</code></p>
<pre><code> &#x6CE8;&#x610F;&#xFF1A;
 &#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x5728;&#x5206;&#x914D;&#x7A7A;&#x95F4;&#x7684;&#x65F6;&#x5019;&#xFF0C;
 &#x7B2C;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;&#x957F;&#x5EA6;&#x5FC5;&#x987B;&#x8981;&#x5199;&#xFF0C;&#x544A;&#x8BC9;&#x4F60;&#x8FD9;&#x4E2A;&#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x91CC;&#x6709;&#x591A;&#x5C11;&#x4E2A;&#x5143;&#x7D20;&#xFF0C;
 &#x7B2C;&#x4E8C;&#x6570;&#x7EC4;&#x957F;&#x5EA6;&#x53EF;&#x4EE5;&#x5199;&#xFF0C;&#x53EF;&#x4EE5;&#x4E0D;&#x5199;&#xFF0C;
 &#x4E0D;&#x8FC7;&#x5199;&#x4E86;&#xFF0C;&#x8868;&#x793A;&#x8FD9;&#x4E2A;&#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x91CC;&#x7684;&#x91CC;&#x9762;&#x7684;&#x5143;&#x7D20;&#xFF08;&#x4E00;&#x7EF4;&#x6570;&#x7EC4;&#xFF09;&#x7684;&#x957F;&#x5EA6;&#xFF0C;
 &#x5982;&#x679C;&#x6CA1;&#x6709;&#x5199;&#xFF0C;&#x8FD9;&#x4E2A;&#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x91CC;&#x9762;&#x7684;&#x5143;&#x7D20;&#xFF08;&#x4E00;&#x7EF4;&#x6570;&#x7EC4;&#xFF09;&#x957F;&#x5EA6;&#x53EF;&#x4EE5;&#x4E0D;&#x4E00;&#x6837;
 &#x64CD;&#x4F5C;&#x6570;&#x636E;&#xFF1A;&#x6570;&#x7EC4;&#x540D;[&#x4E0B;&#x6807;][&#x4E0B;&#x6807;];
 &#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x7684;&#x58F0;&#x660E;&#x548C;&#x5206;&#x914D;&#x7A7A;&#x95F4;&#x5408;&#x5E76;&#x5199;
 &#x6570;&#x636E;&#x7C7B;&#x578B;[][] &#x6570;&#x7EC4;&#x540D;=new &#x6570;&#x636E;&#x7C7B;&#x578B;[&#x6570;&#x7EC4;&#x957F;&#x5EA6;][&#x6570;&#x7EC4;&#x957F;&#x5EA6;]; 
 &#x6216;&#x8005; &#x6570;&#x636E;&#x7C7B;&#x578B;[][] &#x6570;&#x7EC4;&#x540D;=new &#x6570;&#x636E;&#x7C7B;&#x578B;[&#x6570;&#x7EC4;&#x957F;&#x5EA6;][];
</code></pre><pre><code class="lang-java"><span class="hljs-comment">// &#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x7684;&#x58F0;&#x660E;&#x3001;&#x5206;&#x914D;&#x7A7A;&#x95F4;&#x3001;&#x8D4B;&#x503C;&#x5408;&#x5E76;&#x5199;</span>
<span class="hljs-comment">// &#x6570;&#x636E;&#x7C7B;&#x578B;[][] &#x6570;&#x7EC4;&#x540D; = new</span>
<span class="hljs-comment">// &#x6570;&#x636E;&#x7C7B;&#x578B;[][]{&#x6570;&#x636E;1,&#x6570;&#x636E;2,...,&#x6570;&#x636E;n},{&#x6570;&#x636E;1,&#x6570;&#x636E;2,...,&#x6570;&#x636E;n},....,{&#x6570;&#x636E;1,&#x6570;&#x636E;2,...,&#x6570;&#x636E;n};</span>
<span class="hljs-comment">// &#x6CE8;&#x610F;&#xFF1A;new&#x540E;&#x9762;&#x7684;&#x4E24;&#x4E2A;[][]&#x91CC;&#x90FD;&#x4E0D;&#x80FD;&#x5199;&#x6570;&#x7EC4;&#x957F;&#x5EA6;</span>
<span class="hljs-keyword">char</span>[][] chars = <span class="hljs-keyword">new</span> <span class="hljs-keyword">char</span>[][] { { <span class="hljs-string">&apos;a&apos;</span>, <span class="hljs-string">&apos;b&apos;</span>, <span class="hljs-string">&apos;c&apos;</span> }, { <span class="hljs-string">&apos;c&apos;</span>, <span class="hljs-string">&apos;d&apos;</span> },
        { <span class="hljs-string">&apos;m&apos;</span> } };
</code></pre>
<pre><code class="lang-java"><span class="hljs-comment">// &#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x7684;&#x58F0;&#x660E;&#x3001;&#x5206;&#x914D;&#x7A7A;&#x95F4;&#x3001;&#x8D4B;&#x503C;&#x5408;&#x5E76;&#x7684;&#x7B80;&#x5199;&#x65B9;&#x5F0F;</span>
<span class="hljs-comment">// &#x6570;&#x636E;&#x7C7B;&#x578B;[][] &#x6570;&#x7EC4;&#x540D; =</span>
<span class="hljs-comment">// {&#x6570;&#x636E;1,&#x6570;&#x636E;2,...,&#x6570;&#x636E;n},{&#x6570;&#x636E;1,&#x6570;&#x636E;2,...,&#x6570;&#x636E;n},....,{&#x6570;&#x636E;1,&#x6570;&#x636E;2,...,&#x6570;&#x636E;n};</span>
<span class="hljs-keyword">double</span>[][] nums3 = { { <span class="hljs-number">2.5</span>, <span class="hljs-number">5.5</span> }, { <span class="hljs-number">11.5</span>, <span class="hljs-number">55.5</span> }, { <span class="hljs-number">99.9</span>, <span class="hljs-number">88.8</span> },
    { <span class="hljs-number">70.5</span>, <span class="hljs-number">50</span> } };
</code></pre>
<p><strong>&#x4E8C;&#x7EF4;&#x6570;&#x7EC4;&#x7684;&#x5185;&#x5B58;&#x56FE;</strong>
<img src="https://img-blog.csdnimg.cn/697ccf269164405fb8c630dda1de4def.png" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;">
<img src="https://img-blog.csdnimg.cn/dfff2a5288264742b9bbc1dd8f34d0e6.png" alt="&#x5728;&#x8FD9;&#x91CC;&#x63D2;&#x5165;&#x56FE;&#x7247;&#x63CF;&#x8FF0;"></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="006循环结构.html" class="navigation navigation-prev " aria-label="Previous page: 006循环结构">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="008类和对象方法.html" class="navigation navigation-next " aria-label="Next page: 008类和对象方法">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"007数组","level":"2.1.7","depth":2,"next":{"title":"008类和对象方法","level":"2.1.8","depth":2,"path":"books/java/008类和对象方法.md","ref":"books/java/008类和对象方法.md","articles":[]},"previous":{"title":"006循环结构","level":"2.1.6","depth":2,"path":"books/java/006循环结构.md","ref":"books/java/006循环结构.md","articles":[]},"dir":"ltr"},"config":{"plugins":["search-pro","code","back-to-top-button","theme-comscore","intopic-toc","flexible-alerts","expandable-chapters"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"intopic-toc":{"selector":".markdown-section h1, .markdown-section h2, .markdown-section h3, .markdown-section h4, .markdown-section h5, .markdown-section h6","mode":"nested","maxDepth":6,"isCollapsed":true,"isScrollspyActive":true,"visible":true,"label":"In this article"},"search-pro":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"code":{"copyButtons":true},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"theme-comscore":{},"back-to-top-button":{},"flexible-alerts":{"style":"callout","note":{"label":"Note","icon":"fa fa-info-circle","className":"info"},"tip":{"label":"Tip","icon":"fa fa-lightbulb-o","className":"tip"},"warning":{"label":"Warning","icon":"fa fa-exclamation-triangle","className":"warning"},"danger":{"label":"Attention","icon":"fa fa-ban","className":"danger"}},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"作者","lang":"zh-cn","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"isbn":"图书编号","variables":{},"title":"书名","gitbook":"*","description":"描述"},"file":{"path":"books/java/007数组.md","mtime":"2022-12-09T04:20:38.075Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2023-03-01T12:24:55.135Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-intopic-toc/anchor.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-intopic-toc/gumshoe.polyfills.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-intopic-toc/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

